﻿KISSY.use('node,event', function (S, Node, Event) {
    var dropdowns = Node.all(".iui-dropdown > button");
    var menus = Node.all(".iui-dropdown-menu");
    var DOM = S.DOM;

    S.each(dropdowns, function (item) {
        Event.on(item, 'click', function (ev) {
            var menu = DOM.next(item, ".iui-dropdown-menu");
            DOM.toggle(menu);
            ev.stopPropagation();
        });
    })

    S.each(menus, function (item) {
        var lis = DOM.children(item, "li");//菜单项
        S.each(lis, function (itemli) {
            Event.on(itemli, 'click', function (ev) {
                DOM.toggle(item);
                ev.stopPropagation();
            })
        })
    })


    var body = Node.one("body");
    Event.on(body, 'click', function () {
        S.each(menus, function (item) {
            S.one(item).hide();

        })
    });






})


